package com.xiaoze.question.service.impl;

import java.util.List;
import java.util.UUID;

import com.xiaoze.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoze.question.mapper.QuestionAnswerUserMapper;
import com.xiaoze.question.domain.QuestionAnswerUser;
import com.xiaoze.question.service.IQuestionAnswerUserService;

/**
 * 用户回答Service业务层处理
 *
 * @author 胡昊泽
 * @date 2024-08-02
 */
@Service
public class QuestionAnswerUserServiceImpl extends ServiceImpl<QuestionAnswerUserMapper, QuestionAnswerUser> implements IQuestionAnswerUserService {
    @Autowired
    private QuestionAnswerUserMapper questionAnswerUserMapper;

    /**
     * 查询用户回答
     *
     * @param id 用户回答ID
     * @return 用户回答
     */
    @Override
    public QuestionAnswerUser selectQuestionAnswerUserById(Long id) {
        return questionAnswerUserMapper.selectQuestionAnswerUserById(id);
    }

    /**
     * 查询用户回答列表
     *
     * @param questionAnswerUser 用户回答
     * @return 用户回答
     */
    @Override
    public List<QuestionAnswerUser> selectQuestionAnswerUserList(QuestionAnswerUser questionAnswerUser) {
        return questionAnswerUserMapper.selectQuestionAnswerUserList(questionAnswerUser);
    }

    /**
     * 新增用户回答
     *
     * @param questionAnswerUser 用户回答
     * @return 结果
     */
    @Override
    public int insertQuestionAnswerUser(QuestionAnswerUser questionAnswerUser) {
        questionAnswerUser.setCreateTime(DateUtils.getNowDate());
        return questionAnswerUserMapper.insertQuestionAnswerUser(questionAnswerUser);
    }

    /**
     * 修改用户回答
     *
     * @param questionAnswerUser 用户回答
     * @return 结果
     */
    @Override
    public int updateQuestionAnswerUser(QuestionAnswerUser questionAnswerUser) {
        questionAnswerUser.setUpdateTime(DateUtils.getNowDate());
        return questionAnswerUserMapper.updateQuestionAnswerUser(questionAnswerUser);
    }

    /**
     * 批量删除用户回答
     *
     * @param ids 需要删除的用户回答ID
     * @return 结果
     */
    @Override
    public int deleteQuestionAnswerUserByIds(Long[] ids) {
        return questionAnswerUserMapper.deleteQuestionAnswerUserByIds(ids);
    }

    /**
     * 删除用户回答信息
     *
     * @param id 用户回答ID
     * @return 结果
     */
    @Override
    public int deleteQuestionAnswerUserById(Long id) {
        return questionAnswerUserMapper.deleteQuestionAnswerUserById(id);
    }
}
